-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add file extension when using absoluteRuntime
#12827
Add file extension when using absoluteRuntime
#12827
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/49788/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e67e44e:
|
@mbehzad Sorry for the long delay before reviewing this PR: there have been a lot of Could you rebase this PR, and add a test with |
a5aaa13
to
38b64e5
Compare
Hi @nicolo-ribaudo , I've added my changes to the current code, and added a test for |
@mbehzad Hi, I'm just another random person who also ran into this issue, but could you rebase this? I'm wondering if perhaps the regenerator issue can be resolved later as a separate PR, as it may require a change to a package that lives in another repo (https://github.com/babel/babel-polyfills) |
I have rebased babel/babel-polyfills#79. As soon as it's merged, I'll rebase this one. |
…re used (babel#12824) the es module imports need the file extention (e.g. import "@babel/runtime/helpers/jsx.js", Or the filenames being listed in the package.json's subpath exports (e.g. "import "@babel/runtime/helpers/jsx" + pkg: "./helpers/jsx": "./helpers/jsx.js"). when the user passes a path via `absoluteRuntime` then the rendered require staemnts is not the module name + subpath which will be resolved via pkg.json but rather the absolute path to the file. for this case, add the file extention / index.js to prevent bundlers from raising a warning.
38b64e5
to
4a31db7
Compare
absoluteRuntime
with @babel/transform-runtime
absoluteRuntime
with @babel/transform-runtime
absoluteRuntime
with @babel/transform-runtime
absoluteRuntime
with @babel/transform-runtime
absoluteRuntime
@@ -0,0 +1 @@ | |||
// empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This empty file was needed to be able to require.resolve
it.
es module imports need the file extension (e.g.
import "@babel/runtime/helpers/jsx.js"
, Or the filenames being listed in the package.json's subpath exports (e.g.import "@babel/runtime/helpers/jsx"
+ pkg:"./helpers/jsx": "./helpers/jsx.js"
). when the user passes a path viaabsoluteRuntime
then the rendered require statement is not the module name + subpath which will be resolved via pkg.json but rather the absolute path to the file. for this case, add the file extension / index.js to prevent bundlers from raising a warning.